package com.aspose.cells.b.a.b;

import com.aspose.cells.Color;

public class zf {
   public static Color a(String var0) {
      if (var0 == null) {
         return null;
      } else {
         return var0.startsWith("#") ? b(var0) : Color.a(var0);
      }
   }

   private static Color b(String var0) {
      try {
         byte var1 = 0;
         if (var0.length() == 4) {
            StringBuffer var2 = new StringBuffer();
            var2.append(var0.charAt(0));
            var2.append(var0.charAt(1));
            var2.append(var0.charAt(1));
            var2.append(var0.charAt(2));
            var2.append(var0.charAt(2));
            var2.append(var0.charAt(3));
            var2.append(var0.charAt(3));
            var0 = var2.toString();
         }

         if (var0.startsWith("#")) {
            var1 = 1;
         }

         int var6 = Integer.parseInt(var0.substring(var1, var1 + 2), 16);
         int var3 = Integer.parseInt(var0.substring(var1 + 2, var1 + 4), 16);
         int var4 = Integer.parseInt(var0.substring(var1 + 4), 16);
         return Color.fromArgb(var6, var3, var4);
      } catch (Exception var5) {
         return Color.fromArgb(255, 255, 255);
      }
   }
}
